#ifndef DOWNLOADMANAGER_H
#define DOWNLOADMANAGER_H

#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>

class DownloadItem;

class DownloadManager : public QObject
{
    Q_OBJECT

public:
    explicit DownloadManager(QObject *parent = nullptr);
    ~DownloadManager();

    void addDownload(const QString &url);
    void startDownload(int index);
    void pauseDownload(int index);
    void removeDownload(int index);
    
    int downloadCount() const;
    DownloadItem* downloadAt(int index) const;

private:
    QList<DownloadItem*> m_downloads;
    QNetworkAccessManager *m_networkManager;
};

#endif // DOWNLOADMANAGER_H